package method;

public class T6 {
    public static void main(String[] args) {
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i < 2000; i++) {
                    System.out.println(Thread.currentThread().getName()+"---"+i);
                }
            }
        },"A :");
        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 1; i < 2000; i++) {
                    System.out.println(Thread.currentThread().getName()+"---"+i);
                }
            }
        },"B :");

//        设置线程优先级   并不是决定哪个线程先执行完而是 提高概率
        thread1.setPriority(10);
        thread2.setPriority(1);

//      获取线程优先级 默认是5
        System.out.println(thread1.getPriority());
        System.out.println(thread2.getPriority());
        thread1.start();
        thread2.start();
    }
}
